class FormItem {
    constructor({
                    type,
                    name,
                    defaultValue,
                    options, //array(name,value)
                }) {
        this.type = type;
        this.name = name;
        this.defaultValue = defaultValue;
        this.options = options;
    }

    getDisplayText() {
        if (this.options) {
            for (let i = 0; i < this.options.length; i++) {
                if (this.options[i].id === this.defaultValue) {
                    return this.options[i].name;
                }
            }
        }
    }
}


FormItem.type_text = 'text';
FormItem.type_check = 'checkbox';
FormItem.type_radio = 'radio';
FormItem.type_number = 'number';
FormItem.type_rich_text = 'rich_text';
FormItem.type_select = 'select';


export default FormItem
